package com.itlong.cloud.app.service;

import com.itlong.cloud.POJO.DTO.app.AppFaceRecognitionPaymentDTO;
import com.itlong.cloud.POJO.DTO.app.AppTouristDTO;
import com.itlong.cloud.POJO.DTO.app.AppUserRegisterDTO;
import com.itlong.cloud.POJO.PO.AppUserInfoPO;
import com.itlong.cloud.POJO.PO.GuestUserHistoryPO;
import com.itlong.cloud.POJO.VO.MessageVO;
import com.itlong.cloud.POJO.PO.CloudIntercomAccountInfoPO;
import com.itlong.cloud.POJO.VO.app.AppUserCacheVO;
import com.itlong.cloud.POJO.VO.app.AppUserOwnProjectVO;
import org.springframework.web.bind.annotation.RequestParam;

import java.text.ParseException;
import java.util.List;
import java.util.Map;

/**
 * <desc>
 *     APP的登录与注册板块服务层接口
 * </desc>
 *
 * @createDate 2017/9/19
 */
public interface IAppRegisterService {

    /**
     * <desc>
     *     根据手机号检测APP当前用户是否已存在
     * </desc>
     *
     * @param phoneNo  手机号
     * @return true-是，false-否
     * @author cuiduanwu
     * @createDate 2017/09/21
     */
    boolean checkUserByPhoneNo(String phoneNo);


    /**
     * <desc>
     *     根据手机号查询用户
     * </desc>
     * @param phoneNo
     * @return
     * @author cuiduanwu
     * @createDate 2017/09/21
     */
    AppUserInfoPO getUserByPhoneNo(String phoneNo);

    /**
     * <desc>
     *     根据邮箱查询用户
     * </desc>
     * @param email
     * @return
     * @author shengen.T
     * @createDate 2017/09/21
     */
    AppUserInfoPO getUserByEmail(String email);

    /**
     * <desc>
     *     APP端用户注册提交验证
     * </desc>
     *
     * @param appUserRegisterDTO
     * @return
     * @createDate 2017/9/24
     */
    boolean registerUser(AppUserRegisterDTO appUserRegisterDTO) throws Exception;

    /**
     * <desc>
     *     APP端根据手机号更新用户密码
     * </desc>
     *
     * @param phoneNo   手机号
     * @param pswd 新密码
     * @return
     * @throws Exception
     * @author cuiduanwu
     * @createDate 2017/09/25
     */
    boolean updateUserPswdByPhone(String phoneNo,String pswd) throws  Exception;

    /**
     * <desc>
     *      APP端根据邮箱更新用户密码
     * </desc>
     *
     * @param phoneNo  用户邮箱
     * @param pswd  新密码
     * @return
     * @throws Exception
     * @author cuiduanwu
     * @createDate 2017/09/25
     */
    boolean updateUserPswdByEmail(String phoneNo,String pswd) throws  Exception;

    /**
     * <desc>
     *     APP端用户登录
     * </desc>
     *
     * @param phoneNo
     * @param pswd
     * @return AppUserCacheVO
     * @throws Exception
     * @author cuiduanwu
     * @createDate 2017/09/25
     */
    AppUserCacheVO appUserLogin(String phoneNo,String pswd,String loginDevice) throws  Exception;

    /**
     * <desc>
     *     APP端邮箱用户登录
     * </desc>
     *
     * @param email
     * @param pswd
     * @return AppUserCacheVO
     * @throws Exception
     * @author shengen.T
     * @createDate 2017/12/27
     */
    AppUserCacheVO appUserLoginByEmail(String email,String pswd,String loginDevice) throws  Exception;

    /**
     * <desc>
     *     APP端登录获取用户项目列表信息
     * </desc>
     *
     * @param userId  用户ID
     * @param deviceType 设备类型 1-安卓系统，2-ios系统
     * @return  APP用户所拥有的项目配置信息的集合
     * @throws Exception
     * @createDate 2017/9/27
     */
    List<AppUserOwnProjectVO> getUserOwnProjectsInfo(String userId,String deviceType) throws  Exception;

    /**
     * <desc>
     *     APP端登录后缓存用户信息
     * </desc>
     * @param appUserCacheVO
     * @return
     * @author cuiduanwu
     * @createDate 2017/9/27
     */
    boolean loginCacheUserVO(AppUserCacheVO appUserCacheVO) throws Exception;

    /**
     * <desc>
     *     根据userId和projectId查询该用户是否欠费
     * </desc>
     * @param projectId 项目编号
     * @param userId 用户Id
     * @return
     * @author Juguang.S
     * @createDate 2019/01/22
     */
    Integer getUserIsForbidden(String projectId,String userId) throws Exception;

    /**
     * <desc>
     *      查询pad用户是否欠费
     * </desc>
     *
     * @param paymentDTO
     * @return
     * @author Jiaqi.X
     * @createDate 2019/06/21
     */
    Integer getPadUserForbidden(AppFaceRecognitionPaymentDTO paymentDTO);

    /**
     * <desc>
     *      查询pad用户欠费状态
     * </desc>
     *
     * @param paymentDTO
     * @return
     * @author Jiaqi.X
     * @createDate 2019/06/21
     */
    Map<String,Object> getPadUserStatus(AppFaceRecognitionPaymentDTO paymentDTO) throws ParseException;

    /**
     * <desc>
     *      APP端登录根据用户ID与项目编号获取房间总数或业主房间总数
     * </desc>
     *
     * @param userId 用户id
     * @param projectId 项目id
     * @return
     * @throws Exception
     * @createDate 2017/9/28
     */
    Integer countUserAttacheInfoInProject(String userId,String projectId);

    /**
     * <desc>
     *      通过userid获取用户基本信息
     * </desc>
     * @param userId 用户id
     * @return
     * @author Jiaqi.X
     * @createDate 2017/12/22
     */
    AppUserInfoPO getBaseUserInfo(String userId);

    /**
     * <desc>
     *     根据APP端用户的操作日志来自动更新用户Token缓存
     * </desc>
     * @return
     * @author cuiduanwu
     * @createDate 2018/1/18
     */
    boolean timeTaskOfUserTokenUpdate() throws Exception;

    /**
     * <desc>
     *     根据userId查询当前用户是否有人脸
     * </desc>
     * @return
     * @author Juguang.S
     * @createDate 2018/4/24
     */
    Integer getIsFace(String userId) throws Exception;

    /**
     * <desc>
     *     根据cardId查询当前用户
     * </desc>
     * @return
     * @author Juguang.S
     * @createDate 2018/4/24
     */
    String getCardUserId(String cardId) throws Exception;

    /**
     * <desc>
     *     APP端用户缓存丢失后备用查询缓存用户
     * </desc>
     * @param userId
     * @param token
     * @return
     * @author cuiduanwu
     * @createDate 2018/2/5
     */
    AppUserCacheVO resetUserLogin(String userId,String token);

    Integer getAppUserStatusByUserId(String userId);

    /**
     * <desc>
     *     检查当前账号是否被锁定
     * </desc>
     * @param phoneNo 手机号
     * @return
     * @author Juguang.S
     * @createDate 2018/10/16
     */
    MessageVO getAppAccountLockDetail(String phoneNo);

    /**
     * <desc>
     *      App登录错误处理
     * <desc/>
     * @param   phoneNo    手机号
     * @return  标准化响应结果
     * @author Juguang.S
     * @createDate 2018/10/16
     */
    MessageVO loginErrorHandler(String phoneNo,String language);

    /**
     * <desc>
     *      获取用户的第三方账号信息
     * </desc>
     *
     * @param cloudIntercomAccountId 第三方提供账号表的逻辑主键
     * @return 第三方账号信息
     * @author wangzhi
     * @createDate 2018/07/17
     */
    CloudIntercomAccountInfoPO getClientAccount(String cloudIntercomAccountId);

    /**
     * <desc>
     *      获取用户消息状态和欠费房间id
     * </desc>
     *
     * @param currentProjectId 当前项目编号
     * @param userId           用户id
     * @return 用户消息状态和欠费房间id
     * @author wangzhi
     * @createDate 2019/05/29
     */
    AppUserCacheVO getUserMsgAndRoomId(String currentProjectId, String userId, String version) throws Exception;

    /**
     * <desc>
     *      根据userId 登录密码校验密码的正确性
     * </desc>
     *
     * @param userId 用户id
     * @param loginPwd 登录密码
     * @return
     * @throws Exception
     * @createDate 2019/9/17
     */
    Integer checkLoginPwd(String userId,String loginPwd);

    /**
     * <desc>
     *      游客登录
     * </desc>
     *
     * @return 登录信息
     * @author wangzhi
     * @createDate 2020/04/30
     */
    Map<String,Object> touristLogin(AppTouristDTO appTouristDTO) throws Exception;

    /**
     * <desc>
     *      保存游客项目历史信息
     * </desc>
     *
     * @return 受影响行数
     * @author wangzhi
     * @createDate 2020/05/12
     */
    Integer saveOrUpdateGuestProject(GuestUserHistoryPO guestUserHistoryPO) throws Exception;

    /**
     * <desc>
     *      获取游客项目信息
     * </desc>
     *
     * @return 游客项目信息
     * @author wangzhi
     * @createDate 2020/05/18
     */
    AppUserOwnProjectVO getGuestProject(String projectId) throws Exception;

    /**
     * <desc>
     *      查询用户在项目下是否被禁用
     * </desc>
     *
     * @param userId 用户id
     * @param projectId 项目id
     * @return
     * @throws Exception
     * @createDate 2020/11/23
     */
    Integer getUserStatusByProjectId(String userId,String projectId);
}
